home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-14 | 2.1 KB | 64 lines | [TEXT/MPS ] |
- /* _________________________________________________________________________________________________________ //
- Copyright © 1992 Apple Computer, Inc. All rights reserved.
- Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
- Originator: Kent Sandvik
- Date: Wednesday, June 10, 1992 22:37:30
- Revision comments are at the end of this file.
- ---
- TProcess is a Process Manager class.
- ProcessTest.cp contains the testing code for testing TProcess.
- _________________________________________________________________________________________________________ */
-
-
- // Include files
- #ifndef _PROCESS_
- #include "Process.h"
- #endif
-
-
- // This test program will first create a TProcess object that will probe the current process
- // itself. The second test will iterate through processes in the list and print out information.
- // The final test will find the Finder Process ('MACS').
-
-
- void main(void)
- {
- cout << "Start TProcess testing…\n";
-
- // create default TProcess
- TProcess myProcess;
-
- cout << "First test, the current process\n";
- cout << "We have just now " << myProcess.GetNumProcesses() << " processes running.\n";
- cout << "This process has " << myProcess.GetFreeMem() << " memory free.\n";
-
- cout << "\nSecond test, iteration of processes…\n";
-
- for (TProcess procs; !procs.Last(); procs.Next())
- {
- ProcessSerialNumber thePSN = procs.GetProcessID();
- cout << "High Process ID = " << thePSN.highLongOfPSN << "\n";
- cout << "Low Process ID = " << thePSN.lowLongOfPSN << "\n";
-
- cout << "Process size (bytes) = " << procs.GetProcessSize() << "\n";
- cout << "Free memory (bytes) = " << procs.GetFreeMem() << "\n";
- cout << "Launch date (seconds) = " << procs.GetLaunchDate() << "\n";
- }
-
- cout << "\nFinal test, try to find a process with signature 'MACS' (Finder)\n ";
- TProcess findProc;
- if (findProc.FindProcess('MACS'))
- cout << " Finder Process found!\n";
-
- cout << "\nEnd TProcess testing!\n";
- }
-
-
- // _________________________________________________________________________________________________________ //
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 6/10/92 New file
- 2 khs 7/6/92 First decent working class
- */
-